<template>
  <div class="about">
    <van-empty v-if="!retuleObj" description="暂无数据" />
    <van-card v-else
      num="2"
      :price="retuleObj.price"
      :desc="retuleObj.desc"
      :title="retuleObj.name"
      :thumb="retuleObj.url"
    />
  </div>
</template>
<script>
export default {
  data() {
    return {
      retuleList: [], // 存放商品信息的
      retuleObj: {}, // 存放搜索的商品
    };
  },
  created() {
    this.$axios.get("data.json").then((res) => {
      // console.log(res);
      this.retuleList = res.data;
      let name = this.$route.query.value;
      // console.log(name);
      this.retuleObj = this.retuleList.find((item) => item.name == name);
      console.log(this.retuleObj);
    });
  },
};
</script>
